package com.hnevc.vx.Fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.google.gson.Gson;
import com.hnevc.vx.R;
import com.hnevc.vx.adapter.MyAdapater3;
import com.hnevc.vx.bean.LianxXiren;
import com.hnevc.vx.util.GetJsonDataUtil;

import java.util.List;

public class Fragment2 extends Fragment {
    private ListView listView2;

    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_fragment2, container, false);
        listView2 = view.findViewById(R.id.list_view2);
        initView();
        initData();
        initEvent();
        return view;
    }
    private void initView() {

    }

    private void initData() {
        String jsonData = new GetJsonDataUtil().getJson(Fragment2.this.getActivity(), "data.json");
        Gson gson = new Gson();
        LianxXiren lianxXiren = gson.fromJson(jsonData, LianxXiren.class);
        List<LianxXiren.ResultBean> lianxirenlist2 = lianxXiren.getResult();
        listView2.setAdapter(new MyAdapater3(Fragment2.this.getActivity(),lianxirenlist2));

    }

    private void initEvent() {

    }
}
